package kevin.workplan.database.gen.mapper;

import java.util.List;
import kevin.workplan.database.gen.model.Plan;
import kevin.workplan.database.gen.model.PlanExample;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface PlanMapper {
    @SelectProvider(type=PlanSqlProvider.class, method="countByExample")
    int countByExample(PlanExample example);

    @DeleteProvider(type=PlanSqlProvider.class, method="deleteByExample")
    int deleteByExample(PlanExample example);

    @Delete({
        "delete from plan",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into plan (id, uid, bid, ",
        "bname, sid, sname, ",
        "title, create_time, ",
        "finish_time, start_time, ",
        "end_time, progress, ",
        "priority, content)",
        "values (#{id,jdbcType=BIGINT}, #{uid,jdbcType=BIGINT}, #{bid,jdbcType=BIGINT}, ",
        "#{bname,jdbcType=VARCHAR}, #{sid,jdbcType=BIGINT}, #{sname,jdbcType=VARCHAR}, ",
        "#{title,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{finishTime,jdbcType=TIMESTAMP}, #{startTime,jdbcType=TIMESTAMP}, ",
        "#{endTime,jdbcType=TIMESTAMP}, #{progress,jdbcType=INTEGER}, ",
        "#{priority,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR})"
    })
    int insert(Plan record);

    @InsertProvider(type=PlanSqlProvider.class, method="insertSelective")
    int insertSelective(Plan record);

    @SelectProvider(type=PlanSqlProvider.class, method="selectByExampleWithBLOBs")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="bid", property="bid", jdbcType=JdbcType.BIGINT),
        @Result(column="bname", property="bname", jdbcType=JdbcType.VARCHAR),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="sname", property="sname", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="progress", property="progress", jdbcType=JdbcType.INTEGER),
        @Result(column="priority", property="priority", jdbcType=JdbcType.INTEGER),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    List<Plan> selectByExampleWithBLOBs(PlanExample example);

    @SelectProvider(type=PlanSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="bid", property="bid", jdbcType=JdbcType.BIGINT),
        @Result(column="bname", property="bname", jdbcType=JdbcType.VARCHAR),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="sname", property="sname", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="progress", property="progress", jdbcType=JdbcType.INTEGER),
        @Result(column="priority", property="priority", jdbcType=JdbcType.INTEGER)
    })
    List<Plan> selectByExample(PlanExample example);

    @Select({
        "select",
        "id, uid, bid, bname, sid, sname, title, create_time, finish_time, start_time, ",
        "end_time, progress, priority, content",
        "from plan",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="uid", property="uid", jdbcType=JdbcType.BIGINT),
        @Result(column="bid", property="bid", jdbcType=JdbcType.BIGINT),
        @Result(column="bname", property="bname", jdbcType=JdbcType.VARCHAR),
        @Result(column="sid", property="sid", jdbcType=JdbcType.BIGINT),
        @Result(column="sname", property="sname", jdbcType=JdbcType.VARCHAR),
        @Result(column="title", property="title", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="finish_time", property="finishTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="start_time", property="startTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="end_time", property="endTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="progress", property="progress", jdbcType=JdbcType.INTEGER),
        @Result(column="priority", property="priority", jdbcType=JdbcType.INTEGER),
        @Result(column="content", property="content", jdbcType=JdbcType.LONGVARCHAR)
    })
    Plan selectByPrimaryKey(Long id);

    @UpdateProvider(type=PlanSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") Plan record, @Param("example") PlanExample example);

    @UpdateProvider(type=PlanSqlProvider.class, method="updateByExampleWithBLOBs")
    int updateByExampleWithBLOBs(@Param("record") Plan record, @Param("example") PlanExample example);

    @UpdateProvider(type=PlanSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") Plan record, @Param("example") PlanExample example);

    @UpdateProvider(type=PlanSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(Plan record);

    @Update({
        "update plan",
        "set uid = #{uid,jdbcType=BIGINT},",
          "bid = #{bid,jdbcType=BIGINT},",
          "bname = #{bname,jdbcType=VARCHAR},",
          "sid = #{sid,jdbcType=BIGINT},",
          "sname = #{sname,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "finish_time = #{finishTime,jdbcType=TIMESTAMP},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "progress = #{progress,jdbcType=INTEGER},",
          "priority = #{priority,jdbcType=INTEGER},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKeyWithBLOBs(Plan record);

    @Update({
        "update plan",
        "set uid = #{uid,jdbcType=BIGINT},",
          "bid = #{bid,jdbcType=BIGINT},",
          "bname = #{bname,jdbcType=VARCHAR},",
          "sid = #{sid,jdbcType=BIGINT},",
          "sname = #{sname,jdbcType=VARCHAR},",
          "title = #{title,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "finish_time = #{finishTime,jdbcType=TIMESTAMP},",
          "start_time = #{startTime,jdbcType=TIMESTAMP},",
          "end_time = #{endTime,jdbcType=TIMESTAMP},",
          "progress = #{progress,jdbcType=INTEGER},",
          "priority = #{priority,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(Plan record);
}